package com.fivebrms.commands
{
	import org.osflash.thunderbolt.Logger;
	
	import mx.rpc.events.ResultEvent;
	import com.adobe.cairngorm.commands.Command;
	import com.adobe.cairngorm.control.CairngormEvent;
	import mx.controls.Alert;
	import flash.net.FileFilter;
	import flash.net.FileReferenceList;
    import flash.events.Event;
    import flash.net.URLRequest;
    import flash.net.URLRequestMethod;
    import mx.rpc.IResponder;
    import com.fivebrms.events.W9FormSendEvent;
    import com.fivebrms.model.MainModelLocator;
    import com.fivebrms.business.W9Delegate;
    import com.fivebrms.vo.W9FormVO;
    
	public class W9FormCommand implements Command, IResponder
	{
		private var model : MainModelLocator = MainModelLocator.getInstance();
		
		public function execute( event : CairngormEvent ) : void
	 	{
			Logger.info("w9 form command ...execute..");
			var delegate : W9Delegate = new W9Delegate( this );

			Logger.info("start - calling java getw9..");
			delegate.sendW9( model.w9FormVo );
			Logger.info("end - called java getw9..");
						
	 	}
	 	
		public function result( data : Object ) : void
		{
			Logger.info("hey now.result.1 ");

			var event : ResultEvent =  data as ResultEvent;
			Logger.info("hey now.result.11.." + event.result.name );
			
		}
		
		
		public function fault( data:Object ) : void
		{
			Logger.info("hey now.result.2 ");
			Logger.info("result 2--> " + data);
			// Most of the time the info is a FaultEvent, so just cast it here
//			var event:FaultEvent = info as FaultEvent;
		}
	}
}